home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 13 / AMIGAplus Sonderheft 13 (1998)(ICP)(DE)[!].iso / rexx / filertm.rexx < prev    next >
OS/2 REXX Batch file  |  1996-09-23  |  4KB  |  114 lines

  1. /*
  2.     $VER: FilerTM.rexx 1.2 (24.09.96)
  3.  
  4.     Author:
  5.         Michael Böhnisch <billy@uni-paderborn.de>               (mb)
  6.     Matthias Scheler <tron@lyssa.owl.de>            (ms)
  7.  
  8.     Function:
  9.         Makes FilerCom functionality available to ToolManager® dock icons.
  10.  
  11.     Call:
  12.         FilerTM                 Load Filer if necessary and pop it to front
  13.         FilerTM dir1            Additionally read in source directory dir1
  14.         FilerTM dir1 dir2       Additionally read in both directories
  15.         FilerTM path/file       Read path in source directory then perform
  16.                                 default action to file
  17.  
  18.     History:
  19.         30.05.94    1.0 Initial Release                         (mb)
  20.         06.06.94    1.1 Now allows up to 10 Project/Tool icons
  21.                         to be dropped simultaneously on the TM
  22.                         dock icon.                              (mb)
  23.     24.09.96    1.2 replaced "SELECTENTRY" with "SELECTBYNAME"
  24.  
  25. */
  26.  
  27. PARSE ARG Object.1 Object.2 Object.3 Object.4 Object.5 Object.6 Object.7 Object.8 Object.9 Object.10 .
  28.  
  29. /* -------------------------------------------------------------------- */
  30. /* Start Filer if not already running.                                  */
  31. /* -------------------------------------------------------------------- */
  32.  
  33. IF ~SHOW( 'P', 'FilerRexx' ) THEN DO
  34.  
  35.     ADDRESS COMMAND
  36.  
  37.     'Run >NIL: Filer'
  38.  
  39.     /* ---------------------------------------------------------------- */
  40.     /* Wait up to 50 seconds for Filer's AReXX port, time out if it     */
  41.     /* does not show up after this period.                              */
  42.     /* ---------------------------------------------------------------- */
  43.  
  44.     DO 5 WHILE ~SHOW( 'P', 'FilerRexx' )
  45.         'WaitForPort FilerRexx'
  46.     END
  47.     IF RC = 5 THEN DO
  48.         SAY 'Unable to load Filer'
  49.         EXIT
  50.     END
  51. END
  52.  
  53. /* -------------------------------------------------------------------- */
  54. /* By reaching this point Filer should be up'n running. Pull the screen */
  55. /* to the front and respond to the arguments                            */
  56. /* -------------------------------------------------------------------- */
  57.  
  58. ADDRESS 'FilerRexx'
  59.  
  60. FILERTOFRONT
  61.  
  62. IF Object.1 ~= "" THEN DO           /* Are there any arguments at all?  */
  63.  
  64.     /* ---------------------------------------------------------------- */
  65.     /* Load rexxsupport function host if not already present            */
  66.     /* ---------------------------------------------------------------- */
  67.  
  68.     IF ~SHOW( 'L', 'rexxsupport.library' ) THEN DO
  69.         ADDLIB( 'rexxsupport.library', 0, -30, 0 )
  70.     END
  71.  
  72.     /* ---------------------------------------------------------------- */
  73.     /* Get type of arguments and react depending to the type            */
  74.     /* ---------------------------------------------------------------- */
  75.  
  76.     IF LEFT( STATEF( Object.1 ), 1 ) = 'D' THEN DO
  77.  
  78.         /* ------------------------------------------------------------ */
  79.         /* First argument is a directory                                */
  80.         /* ------------------------------------------------------------ */
  81.  
  82.         READSOURCEDIR Object.1
  83.  
  84.         IF Object2 ~= "" THEN DO
  85.  
  86.             IF LEFT( STATEF( Object.2 ), 1 ) = 'D' THEN DO
  87.  
  88.                 /* ---------------------------------------------------- */
  89.                 /* Second argument valid and is a directory             */
  90.                 /* ---------------------------------------------------- */
  91.  
  92.                 READTARGETDIR Object.2
  93.                 OTHERDIR
  94.             END
  95.  
  96.         END
  97.     END
  98.     ELSE DO
  99.  
  100.         /* ------------------------------------------------------------ */
  101.         /* First argument is a file, ignore other argument(s)           */
  102.         /* ------------------------------------------------------------ */
  103.  
  104.     DO i = 1 TO 10
  105.             IF Object.i ~= "" THEN DO
  106.                 divpos = MAX( LASTPOS( ':', Object.i ), LASTPOS( '/', Object.i ) ) + 1
  107.                 READSOURCEDIR STRIP( LEFT( Object.i, divpos - 1 ), 'T', '/' )
  108.                 'SELECBYNAME "'||SUBSTR( Object.i, divpos )||'"'
  109.                 ACTION
  110.             END
  111.     END
  112.     END
  113. END
  114.